package com.example.administrator.asynctask;

import android.os.AsyncTask;

import com.example.administrator.instantes.GetByte;
import com.example.administrator.utils.HttpUtils;

/**
 * Created by Administrator on 2016/11/25.
 */
public class MyAsyncTask extends AsyncTask<String,Void,byte[]>{
    private GetByte callback;

    public MyAsyncTask(GetByte callback) {
        this.callback = callback;
    }

    @Override
    protected byte[] doInBackground(String... params) {
        byte[] bytes = HttpUtils.getBytes(params[0]);


        return bytes;
    }

    @Override
    protected void onPostExecute(byte[] bytes) {
        super.onPostExecute(bytes);
        if (bytes!=null){
            callback.getBytes(bytes);
        }
    }
}
